package com.nju.demos;

public class CalculateHuiWen {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		char[] word = { 'a', 'b', 'b', 'b', 'a' };
		boolean result = testWordHuiWen(word, 0, word.length - 1);
		System.out.println(result);
	}

	public static boolean testWordHuiWen(char[] word, int low, int high) {
		if (low == high) {
			return true;
		} else if (low + 1 == high) {
			if (word[low] == word[high]) {
				return true;
			} else {
				return false;
			}
		} else {
			return testWordHuiWen(word, low + 1, high - 1);
		}
	}

}
